package org.example.myAop.service.impl;

import jakarta.annotation.Resource;
import org.example.myAop.dao.UserDao;
import org.example.myAop.entity.User;
import org.example.myAop.service.UserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.Arrays;
import java.util.List;

/**
 * @author 莫磊
 * @date 2025/7/31
 * @description
 */
@Service
public class OtherServiceImpl implements UserService {

	@Resource
	private UserDao userDao;

	@Override
	public void addUser(List<User> list) {

	}

	@Override
	public void updateUser(List<User> list) {

	}

	@Override
	public List<User> queryUser() {
		return null;
	}

	@Override
	public void testAop() {

	}

	@Override
	@Transactional(propagation = Propagation.REQUIRES_NEW)
	public void addUserForOne(User user) {
		user.setName(user.getName() + "addUserForOne");
		userDao.addUser(Arrays.asList(user));
		String str = null;
		str.toString();
	}
}
